import math

def dotProduct(v1, v2):
    assert len(v1) == len(v2)
    answer = 0
    for i in range(len(v1)):
        answer += v1[i] * v2[i]
        
def crossProduct(v1, v2):
    vec1 = [0,0]
    vec2 = [0,0]    
    vec1[0] = v1[1][0] - v1[0][0]
    vec1[1] = v1[1][1] - v1[0][1]
    vec2[0] = v2[1][0] - v2[0][0]
    vec2[1] = v2[1][1] - v2[0][1]    
    return vec1[0] * vec2[1] - vec1[1] * vec2[0]
    
def isRight(pair1, pair2):
    vector1 = pair1[0]
    vector2 = pair1[1]
    secondVector = pair2[0]
    if crossProduct(vector1, vector2) <= 0:
        if( crossProduct(vector1, secondVector) <= 0 ):
            return False
        elif( crossProduct(vector2, secondVector) <= 0 ):
            return False
        else:
            return True
    else:
        if( crossProduct(vector1, secondVector) >= 0 ):
            return True
        elif( crossProduct(vector2, secondVector) >= 0 ):
            return True
        else:
            return False
        
        
        
def arePairsEquall(p1, p2):
    return ( p1[0] == p2[0] ) and ( p1[1] == p2[1] )

def areLocalRoutesEqual(r1, r2, n):
    p1 = r1.getPairOfEdges(n)
    p2 = r2.getPairOfEdges(n)
    return arePairsEquall(p1, p2)